package com.xuhaijian.utils;

import cn.hutool.json.JSONUtil;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

public class JsonToObjUtils {
    public static <T> T jsonToObj(String path, Class<T> beanClass) throws IOException {
        List<String> lines = Files.readAllLines(Paths.get(path));
        String content = String.join("\n", lines); // 用换行符拼接
        return JSONUtil.toBean(content,beanClass);
    }
}
